#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->pushButton->setStyleSheet("color:blue");
    ui->pushButton->setFlat(true);
    ui->tableWidget->setColumnCount(8);
    //ui->tableWidget->setRowCount(9);
    ui->tableWidget->setColumnWidth(0,157);
    ui->tableWidget->setColumnWidth(1,157);
    ui->tableWidget->setColumnWidth(2,157);
    ui->tableWidget->setColumnWidth(3,157);
    ui->tableWidget->setColumnWidth(4,157);
    ui->tableWidget->setColumnWidth(5,157);
    ui->tableWidget->setColumnWidth(6,157);
    ui->tableWidget->setColumnWidth(7,157);
    QStringList header;
    header<<QString("课程编码")<<QString("课程名称")<<QString("授课老师")<<QString("教学班名称")<<QString("上课时间地点")<<QString("教学校区")<<QString("选课性质")<<QString("操作");
    ui->tableWidget->setHorizontalHeaderLabels(header);
    ui->tableWidget->horizontalHeader()->setVisible(true);
    ui->tableWidget->verticalHeader()->setVisible(false);
    ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_comboBox_currentIndexChanged(int index)
{
   if(index == 0){ui->tableWidget->clearContents();}
   if(index == 1)
   {
       ui->tableWidget->setRowCount(9);
       ui->tableWidget->setRowHeight(0,45);
       ui->tableWidget->setRowHeight(1,45);
       ui->tableWidget->setRowHeight(2,45);
       ui->tableWidget->setRowHeight(3,45);
       ui->tableWidget->setRowHeight(4,45);
       ui->tableWidget->setRowHeight(5,45);
       ui->tableWidget->setRowHeight(6,45);
       ui->tableWidget->setRowHeight(7,45);
       ui->tableWidget->setRowHeight(8,45);

       ui->tableWidget->setItem(0,0,new QTableWidgetItem("390252Z11"));
       ui->tableWidget->setItem(1,0,new QTableWidgetItem("660001T30"));
       ui->tableWidget->setItem(2,0,new QTableWidgetItem("180533T10	"));
       ui->tableWidget->setItem(3,0,new QTableWidgetItem("210202T10"));
       ui->tableWidget->setItem(4,0,new QTableWidgetItem("130712X10"));
       ui->tableWidget->setItem(5,0,new QTableWidgetItem("390210X10"));
       ui->tableWidget->setItem(6,0,new QTableWidgetItem("390226Z10"));
       ui->tableWidget->setItem(7,0,new QTableWidgetItem("390124Z10"));
       ui->tableWidget->setItem(8,0,new QTableWidgetItem("390109X10"));

       ui->tableWidget->setItem(0,1,new QTableWidgetItem("软件实用技术实习（Java）"));
       ui->tableWidget->setItem(1,1,new QTableWidgetItem("体育（三）"));
       ui->tableWidget->setItem(2,1,new QTableWidgetItem("高级英语（一）"));
       ui->tableWidget->setItem(3,1,new QTableWidgetItem("中国近现代史纲要	"));
       ui->tableWidget->setItem(4,1,new QTableWidgetItem("概率论与数理统计	"));
       ui->tableWidget->setItem(5,1,new QTableWidgetItem("操作系统原理"));
       ui->tableWidget->setItem(6,1,new QTableWidgetItem("汇编语言程序设计	"));
       ui->tableWidget->setItem(7,1,new QTableWidgetItem("用户界面设计与评价SSD4"));
       ui->tableWidget->setItem(8,1,new QTableWidgetItem("集合论与代数"));

       ui->tableWidget->setItem(0,2,new QTableWidgetItem("张凌燕,邝砾"));
       ui->tableWidget->setItem(1,2,new QTableWidgetItem("王炳南"));
       ui->tableWidget->setItem(2,2,new QTableWidgetItem("伍宏传"));
       ui->tableWidget->setItem(3,2,new QTableWidgetItem("吴冠中"));
       ui->tableWidget->setItem(4,2,new QTableWidgetItem("张齐"));
       ui->tableWidget->setItem(5,2,new QTableWidgetItem("胡志刚,郑美光"));
       ui->tableWidget->setItem(6,2,new QTableWidgetItem("曾锋"));
       ui->tableWidget->setItem(7,2,new QTableWidgetItem("郁松"));
       ui->tableWidget->setItem(8,2,new QTableWidgetItem("费洪晓"));

       ui->tableWidget->setItem(0,3,new QTableWidgetItem("软件工程2001-06"));
       ui->tableWidget->setItem(1,3,new QTableWidgetItem("软件工程2005"));
       ui->tableWidget->setItem(2,3,new QTableWidgetItem("科技英语-019864	"));
       ui->tableWidget->setItem(3,3,new QTableWidgetItem("软件工程2004-06	"));
       ui->tableWidget->setItem(4,3,new QTableWidgetItem("软件工程2004-06	"));
       ui->tableWidget->setItem(5,3,new QTableWidgetItem("软件工程2004-06	"));
       ui->tableWidget->setItem(6,3,new QTableWidgetItem("软件工程2004-06	"));
       ui->tableWidget->setItem(7,3,new QTableWidgetItem("软件工程2004-06	"));
       ui->tableWidget->setItem(8,3,new QTableWidgetItem("软件工程2004-06	"));

       ui->tableWidget->setItem(0,4,new QTableWidgetItem(""));
       ui->tableWidget->setItem(1,4,new QTableWidgetItem("(3-10,12-18,星期四0304节)"));
       ui->tableWidget->setItem(2,4,new QTableWidgetItem("(3-18,星期五0102节,世A102(世A))"));
       ui->tableWidget->setItem(3,4,new QTableWidgetItem("(3-18,星期一0708节,世A504(世A))	"));
       ui->tableWidget->setItem(4,4,new QTableWidgetItem("(3-16,星期三0102节,世A502(世A))"));
       ui->tableWidget->setItem(5,4,new QTableWidgetItem("(3-14,星期四0708节,世A402(世A))"));
       ui->tableWidget->setItem(6,4,new QTableWidgetItem("(3-10,星期二0304节,世A404(世A))"));
       ui->tableWidget->setItem(7,4,new QTableWidgetItem("(11-18,星期五0506节,世A504(世A))"));
       ui->tableWidget->setItem(8,4,new QTableWidgetItem("(3-14,星期五0708节,世A402(世A))"));



       for(int i = 0;i <= 8 ; i++)
       {
           QPushButton *pBtn = new QPushButton("退课");
           ui->tableWidget->setItem(i,5,new QTableWidgetItem("铁道校区"));
           ui->tableWidget->setItem(i,6,new QTableWidgetItem("正常"));
           ui->tableWidget->setCellWidget(i,7,pBtn);
       }
   }
   if(index == 2)
   {
        ui->tableWidget->clearContents();
        ui->tableWidget->setRowCount(12);
        ui->tableWidget->setRowHeight(0,45);
        ui->tableWidget->setRowHeight(1,45);
        ui->tableWidget->setRowHeight(2,45);
        ui->tableWidget->setRowHeight(3,45);
        ui->tableWidget->setRowHeight(4,45);
        ui->tableWidget->setRowHeight(5,45);
        ui->tableWidget->setRowHeight(6,45);
        ui->tableWidget->setRowHeight(7,45);
        ui->tableWidget->setRowHeight(8,45);
        ui->tableWidget->setRowHeight(9,45);
        ui->tableWidget->setRowHeight(10,45);
        ui->tableWidget->setRowHeight(11,45);
        ui->tableWidget->setItem(0,0,new QTableWidgetItem("180501T20"));
        ui->tableWidget->setItem(1,0,new QTableWidgetItem("660001T20"));
        ui->tableWidget->setItem(2,0,new QTableWidgetItem("390217X11"));
        ui->tableWidget->setItem(3,0,new QTableWidgetItem("390107X10"));
        ui->tableWidget->setItem(4,0,new QTableWidgetItem("390106X10"));
        ui->tableWidget->setItem(5,0,new QTableWidgetItem("390108X10"));
        ui->tableWidget->setItem(6,0,new QTableWidgetItem("390101X10"));
        ui->tableWidget->setItem(7,0,new QTableWidgetItem("130711X10"));
        ui->tableWidget->setItem(8,0,new QTableWidgetItem("130702X20"));
        ui->tableWidget->setItem(9,0,new QTableWidgetItem("3-43"));
        ui->tableWidget->setItem(10,0,new QTableWidgetItem("4-52"));
        ui->tableWidget->setItem(11,0,new QTableWidgetItem("210102T10"));

        ui->tableWidget->setItem(0,1,new QTableWidgetItem("大学英语（二）"));
        ui->tableWidget->setItem(1,1,new QTableWidgetItem("体育（二）"));
        ui->tableWidget->setItem(2,1,new QTableWidgetItem("工程技能实习（C++）"));
        ui->tableWidget->setItem(3,1,new QTableWidgetItem("离散结构"));
        ui->tableWidget->setItem(4,1,new QTableWidgetItem("数据结构"));
        ui->tableWidget->setItem(5,1,new QTableWidgetItem("Java面向对象程序设计SSD3"));
        ui->tableWidget->setItem(6,1,new QTableWidgetItem("基础物理学"));
        ui->tableWidget->setItem(7,1,new QTableWidgetItem("线性代数"));
        ui->tableWidget->setItem(8,1,new QTableWidgetItem("高等数学A2（二）"));
        ui->tableWidget->setItem(9,1,new QTableWidgetItem("水彩画赏析与体验"));
        ui->tableWidget->setItem(10,1,new QTableWidgetItem("3D打印技术的基础与应用"));
        ui->tableWidget->setItem(11,1,new QTableWidgetItem("大学生心理健康教育"));

        ui->tableWidget->setItem(0,2,new QTableWidgetItem("侯先绒,骆莲莲,荣觅"));
        ui->tableWidget->setItem(1,2,new QTableWidgetItem("彭嘉欣"));
        ui->tableWidget->setItem(2,2,new QTableWidgetItem("费洪晓,谭长庚"));
        ui->tableWidget->setItem(3,2,new QTableWidgetItem("费洪晓"));
        ui->tableWidget->setItem(4,2,new QTableWidgetItem("郁松"));
        ui->tableWidget->setItem(5,2,new QTableWidgetItem("邝砾"));
        ui->tableWidget->setItem(6,2,new QTableWidgetItem("陈学工,陈雪晨"));
        ui->tableWidget->setItem(7,2,new QTableWidgetItem("袁修贵"));
        ui->tableWidget->setItem(8,2,new QTableWidgetItem("邓卫军"));
        ui->tableWidget->setItem(9,2,new QTableWidgetItem("蒋烨,孔果"));
        ui->tableWidget->setItem(10,2,new QTableWidgetItem("唐晶晶,周向阳"));
        ui->tableWidget->setItem(11,2,new QTableWidgetItem("陈锐"));

        ui->tableWidget->setItem(0,3,new QTableWidgetItem("软件工程2006"));
        ui->tableWidget->setItem(1,3,new QTableWidgetItem("篮球-017503"));
        ui->tableWidget->setItem(2,3,new QTableWidgetItem("软件工程2001-06"));
        ui->tableWidget->setItem(3,3,new QTableWidgetItem("软件工程2004-06"));
        ui->tableWidget->setItem(4,3,new QTableWidgetItem("软件工程2004-06"));
        ui->tableWidget->setItem(5,3,new QTableWidgetItem("软件工程2004-06"));
        ui->tableWidget->setItem(6,3,new QTableWidgetItem("软件工程2004-06"));
        ui->tableWidget->setItem(7,3,new QTableWidgetItem("信管T2001班应化T2001班软件工程2005-06"));
        ui->tableWidget->setItem(8,3,new QTableWidgetItem("软件工程2004-06"));
        ui->tableWidget->setItem(9,3,new QTableWidgetItem("016684"));
        ui->tableWidget->setItem(10,3,new QTableWidgetItem("017097"));
        ui->tableWidget->setItem(11,3,new QTableWidgetItem("软件工程2004-06"));

        ui->tableWidget->setItem(0,4,new QTableWidgetItem("(1-6,8-16,星期二0304节,外语网络楼346(外语网络楼))"));
        ui->tableWidget->setItem(1,4,new QTableWidgetItem("(1-16,星期五0304节,)"));
        ui->tableWidget->setItem(2,4,new QTableWidgetItem(""));
        ui->tableWidget->setItem(3,4,new QTableWidgetItem("(9-16,星期一0708节,B座506(B座))"));
        ui->tableWidget->setItem(4,4,new QTableWidgetItem("(1-12,星期二0102节,B座508(B座))"));
        ui->tableWidget->setItem(5,4,new QTableWidgetItem("(5-16,星期二0708节,B座502(B座))"));
        ui->tableWidget->setItem(6,4,new QTableWidgetItem("(1-16,星期一0910节,B座502(B座))"));
        ui->tableWidget->setItem(7,4,new QTableWidgetItem("(1-8,星期一0506节,B座420(B座))"));
        ui->tableWidget->setItem(8,4,new QTableWidgetItem("(1-16(单周),星期五0506节,C座104(C座))"));
        ui->tableWidget->setItem(9,4,new QTableWidgetItem("(1-16,星期四0910节,A座310(A座))"));
        ui->tableWidget->setItem(10,4,new QTableWidgetItem("(9-16,星期二0910节,B座507(B座))"));
        ui->tableWidget->setItem(11,4,new QTableWidgetItem("(9-16(单周),星期四0708节,B座411(B座))"));


        for(int i = 0;i <= 11 ; i++)
        {
            QPushButton *pBtn = new QPushButton("退课");
            ui->tableWidget->setItem(i,5,new QTableWidgetItem("新校区"));
            ui->tableWidget->setItem(i,6,new QTableWidgetItem("正常"));
            ui->tableWidget->setCellWidget(i,7,pBtn);
        }
   }
   if(index == 3)
   {
        ui->tableWidget->clearContents();
   }
}
